% Language support (english/español)
\usepackage[spanish,english]{babel}

%For spanish we need indentation on the first line
\usepackage{indentfirst}

% Prevent latex from expanding to fill page
\raggedbottom

%Use the margins requested
\usepackage[hmargin={3.5cm,2.5cm},vmargin=2.5cm]{geometry}

%Improved bibliography
\usepackage{natbib}
\bibpunct{[}{]}{;}{n}{,}{,}

% To define spacing
\usepackage{setspace}

% We use these packages for making the nice logo on the title page
\usepackage{graphicx}

% Use input characters instead of escape codes
\usepackage[utf8]{inputenc}	

% Generate fancy chapter titles
\usepackage[Bjarne]{fncychap}
\renewcommand{\AlphaNo}{%
    \ifcase\number\theAlphaCnt
	CERO\or UNO\or DOS\or TRES\or CUATRO\or CINCO
    \or SEIS\or SIETE\or OCHO\or NUEVE\or DIEZ
    \or ONCE\or DOCE\or TRECE\or CATORCE\or QUINCE
    \or DIECISÉIS\or DIECISIETE\or DIECIOCHO\or DIECINUEVE\fi
}

%Use Fancy headers
\usepackage{fancyhdr}

% Generate pretty PDF with links on the TOC
%!\usepackage{mdwlist}		% WHAT FOR?
%!\usepackage{alltt}		% WHAT FOR?
\usepackage[
	%dvips, 
	bookmarks=true,
	linktoc=all,
	colorlinks=false,
	pdftitle={\thesistitle},
	pdfauthor={\pdfauthor},
	pdfsubject={\thesistitle},
	pdfkeywords={\thesiskeywords},
	linkcolor=blue,
	filecolor=blue,
	urlcolor=blue,
	citecolor=blue,
	hidelinks
						]{hyperref}

% Allow epigraphs at the beginning of chapters
\usepackage{epigraph}

% For color definitions
\usepackage[usenames,dvipsnames]{xcolor}

% Para uso de las tablas
\usepackage[noenc]{tipa}

% new options for column alignment in the array andtabular environments
\usepackage{array}

% homonymic supertabular environment that behaves like the regular tabular but, 
% when compiling, it checks the length of the table at every row
\usepackage{supertabular}

%\usepackage{tipx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}

% Define abstract environment since it doesn't exists on book class
\newenvironment{abstract}%
{\cleardoublepage\null \vfill \begin{center}%
\bfseries \abstractname \end{center}}
{\vfill\null}

% Generation of nomenclature
\usepackage{nomencl}
\makenomenclature

% Generation of acronyms
\usepackage{acronym}

% Generation of chess boards and games
\usepackage{skak}

% Generation os subfigures
\usepackage[lofdepth,lotdepth]{subfig}

\renewcommand\shorthandsspanish{}
\usepackage[matrix,arrow]{xy}
% Generation of awesome figures
\usepackage{tikz}

% Comment this out when is not a draft
%\usepackage{draftwatermark}
%\SetWatermarkLightness{0.95}
%\SetWatermarkFontSize{5cm}
%\SetWatermarkScale{5}
%\SetWatermarkText{DRAFT}

% Custom commands
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\selectlanguage{spanish}

% Generating template for acknowledgement section
\newcommand\ackname{Acknowledgements}
\if@titlepage
  \newenvironment{acknowledgements}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \ackname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}
\else
  \newenvironment{acknowledgements}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
        \small
        \begin{center}%
          {\bfseries \ackname\vspace{-.5em}\vspace{\z@}}%
        \end{center}%
        \quotation
      \fi}
      {\if@twocolumn\else\endquotation\fi}
\fi
\makeatother
